{include file="public/meat" title="添加栏目"/}
<div class="cx-fex-c">
    <div class="x11 pad-t15 pad-b10">
        <div class="cx-fex-c">
            <div class="layout">
                <a href="{:url('index',array('mid'=>$Request.param.mid))}" class="button bg-blue">返回栏目列表</a>
                {if $btn.add}
                <a href="{:url('add')}" class="button bg-blue">添加栏目</a>
                {/if}
            </div>
        </div>
    </div>
    <div class="x11">
        <fieldset class="cx-field">
            <legend class="cx-field-legend">添加栏目</legend>
        <form class="layui-form" role="form" action="" method="post">
            <div class="cx-fex-l mb-10">
                <div class="x3 t-r">
                    <label class="lab">上级栏目</label>
                </div>
                <div class="xs8 xl9">
                    <select  name="pid" required lay-filter='formtype'>
                        <option {eq name="$postdb.pid|default='0'" value="0"}selected{/eq} value="0">顶级分类</option>
                        {volist name="postdb.pids" id="cx"}
                        <option {eq name="$postdb.pid|default=''" value="$cx.id"}selected{/eq} value="{$cx.id}">{$cx.icon|default=''}{$cx.title}</option>
                        {/volist}
                    </select>
                </div>
            </div>
            <div class="cx-fex-l mb-10">
                <div class="x3 t-r">
                    <label class="lab">栏目名称</label>
                </div>
                <div class="xs8 xl9">
                    <input class="ipt" placeholder="请输入栏目名称" name="title" required="" type="text" value="{$postdb.title}">
                </div>
            </div>
            <div class="cx-fex-l mb-10">
                <div class="x3 t-r">
                    <label class="lab">栏目类型</label>
                </div>
                <div class="xs8 xl9">
                    <input name="class" required type="radio" value="0" {eq name="$postdb.class" value="0"}checked="checked"{/eq} title="大分类">
                    <input name="class" required type="radio" value="1" {eq name="$postdb.class" value="1"}checked="checked"{/eq} title="小栏目">
                    <input name="class" required type="radio" value="2" {eq name="$postdb.class" value="2"}checked="checked"{/eq} title="单篇文章">
                </div>
            </div>
            <div class="cx-fex-l mb-10">
                <div class="x3 t-r">
                    <label class="lab">风格</label>
                </div>
                <div class="xs8 xl9">
                    <select name="plate" lay-filter='plates'>
                        {$postdb.plates}
                    </select>
                </div>
            </div>
            <div class="cx-fex-l mb-10">
                <div class="x3 t-r">
                    <label class="lab">自订义风格</label>
                </div>
                <div class="xs8 xl9">
                    <div class="cx-input-tabel">
                        <span class="cx-input-fl">头部</span>
                        <input name="template[head]" class="ipt" placeholder="默认值一般为空" type="text" value="{$postdb.temps.head|default=''}" >
                        <div class="cx-input-flselect">
                            <select class="cx-input-fl">
                                <option>默认风格</option>
                            </select>
                        </div>
                    </div>
                    <div class="cx-input-tabel mt-10">
                        <span class="cx-input-fl">底部</span>
                        <input name="template[foot]" class="ipt" placeholder="默认值一般为空" type="text" value="{$postdb.temps.foot|default=''}" >
                        <div class="cx-input-flselect">
                            <select class="cx-input-fl">
                                <option>默认风格</option>
                            </select>
                        </div>
                    </div>
                    <div class="cx-input-tabel mt-10">
                        <span class="cx-input-fl">内容页</span>
                        <input name="template[cont]" class="ipt" placeholder="默认值一般为空" type="text" value="{$postdb.temps.cont|default=''}" >
                        <div class="cx-input-flselect">
                            <select class="cx-input-fl">
                                <option>默认风格</option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>
            <div class="cx-fex-l mb-10">
                <div class="x3 t-r">
                    <label class="lab">内容</label>
                </div>
                <div class="xs8 xl9">
                    <div id="description">{$postdb.description}</div>
                    <textarea id="descriptiontxt" style="display: none" name="description">{$postdb.description}</textarea>
                </div>
            </div>
            <div class="cx-fex-l mb-10 padding-top-20 padding-left-20">
                <div class="x3 t-r">
                    <label class="lab"></label>
                </div>
                <div class="xs8 xl9">
                    <input class="ipt" name="id" required="" type="hidden" value="{$postdb.id}">
                    <input type="hidden" name="__token__" required lay-verify="required" value="{$Request.token}" />
                    <button type="submit" class="button bg-blue">提交</button>
                </div>
            </div>
        </form>
        </fieldset>
    </div>
</div>
<div style="height: 20px; overflow: hidden"></div>
{include file="public/js" /}
{load href="__EDITOR__/wangEditor.min.js" /}
<script type="text/javascript">
    var E = window.wangEditor
    var editor = new E('#description');
    var $descriptiontxt = $('#descriptiontxt')
    //  配置上传路径
    editor.customConfig.uploadImgServer = "{:url('Uploads/wangeditor')}";
    editor.customConfig.uploadImgMaxSize = 1 * 1024 * 1024;
    editor.customConfig.onchange = function (html) {
        // 监控变化，同步更新到 textarea
        $descriptiontxt.val(html)
    }
    editor.create();
    $descriptiontxt.val(editor.txt.html())
</script>
<script>
    layui.config({
        base: '__ADMIN__/js/'
    }).use('app');
</script>
{include file="public/footer" /}